package my.edu.model.commodity.entity.dto;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Null;
import jakarta.validation.groups.Default;
import lombok.Data;
import my.edu.common.validate.groups.Insert;
import my.edu.common.validate.IntegerPattern;

import java.math.BigDecimal;

@Data
public class ProductDTO {
    //Validated后不加参数就匹配 Default.class的参数校验
    //加参数，就匹配对应参数类的参数校验
    @Null(message = "id必须为空",groups = Insert.class)
    @NotNull(message = "id不能为空" ,groups = { Default.class})
    private Long id;
    private Long categoryId;
    @IntegerPattern(regexp = "^[01]$", message = "状态参数错误", groups = {Insert.class, Default.class})
    private Integer status;
    @NotBlank(message = "商品编号不能为空", groups = {Insert.class, Default.class})
    private String productNo;
    private String imageUrl;
    private String productName;
    private Integer expiryNum;
    private String specificationModel;//规模型号
    private Long defaultSupplierId;//默认供应商id
    private String brand;//品牌
    private String unit;//单位
    private Integer currentStock;//当前库存
    private Integer initialQuantity;//期初数量
    private BigDecimal unitCost;//单位成本
    private BigDecimal initialTotalPrice;//期初总价
    private BigDecimal estimatedPurchasePrice;//预计采购价
    private BigDecimal highestPurchasePrice;//最高采购价
    private BigDecimal latestPurchasePrice;//最新采购价
    private BigDecimal lowestSalesPrice;//最低销售价
    private Integer minimumStock;//最低库存
    private String remark;
    @IntegerPattern(regexp = "^[01]$", message = "是否常用参数错误", groups = {Insert.class, Default.class})
    private Integer isCommon;//是否常用
}
